
/**
  * Created by feng on 14/11/2018.
  */
object Test {

  val func = (x:Int) => x * 10


  def m1(f:Int=>Int):Int={
      f(3)
  }

  def main(args: Array[String]): Unit = {
//    for (i<-1 to 10){
////      println(i+"的阶乘"+factor(i))
//    }
//    var compat = new Point(10,20)
//    compat.move(10,10)

//    val location = new Location(10,20,30)
//    location.move(10,20)

//    println(m1(func))

    val array = Array(1,2,3,4,5,6,7,8,9)
    var r1 = array.map(x=>x*5)
    var r2 = array.map(x=>x-1)
    println(array)
    println(r1.toBuffer)
    println(r2.toBuffer)
    println(array.toBuffer)

  }

  def func(x:Int):Int={
    return x+1
  }

  /*递归*/
  def factor(n:BigInt):BigInt={
    if (n<=1){
      return 1
    }else{
      return n * factor(n-1)
    }
  }
}

class Point(xc:Int,yc:Int){
  var x:Int=xc
  var y:Int=yc

  def move(dx:Int,dy:Int){
    x = x + dx
    y = y + dy
    println("x 的坐标点:"+x)
    println("y 的坐标点:"+y)
  }
}

class Location( val xc:Int, val yc:Int,val zc:Int) extends Point(xc,yc){

  var z:Int =zc;

//  def move(dx:Int,dy:Int,dz:Int): Unit ={
//    x = x + dx
//    y = y + dy
//    z = z + dz
//
//    println("x 的坐标点"+x)
//    println("y 的坐标点"+y)
//    println("z 的坐标点"+z)
//  }

}